public class EX7_7 {
   public static void main(String args[]) {
      CargoBoat ship = new CargoBoat();
       CargoBoat ship2 = new CargoBoat();
      ship.setMaxContent(1000);
      ship2.setMinContent(126);
      int m =600;
      int n =10;
      try{  
           ship.loading(m);
           m = 400;
           ship.loading(m);
           m = 367;
           ship.loading(m);
           m = 555;
           ship.loading(m);
      }
      catch(DangerException e) {
           System.out.println(e.warnMess()); 
           System.out.println("无法再装载重量是"+m+"吨的集装箱");       
      }

      try{
           ship2.loading2(n);
           n = 50;
           ship2.loading2(n);
           n = 20;
      }
      catch(DangerException2 e) {
           System.out.println(e.warnMess());
           System.out.println("超轻的装载重量是"+n+"吨的集装箱");
      }
      finally {
          System.out.printf("货船将正点启航\n");
      }
  }
}

